package fr.umlv.projet.android.login;

import android.app.IntentService;
import android.content.Intent;
import fr.umlv.projet.android.subject.ListSubjectActivity;
import fr.umlv.projet.android.utils.ServerHelper;

public class LoginService extends IntentService {

	public LoginService() {
		super("LoginService");
	}

	@Override
	protected void onHandleIntent(Intent intent) {
		String address = intent.getStringExtra("address");
		String port = intent.getStringExtra("port");
		String username = intent.getStringExtra("username");
		String password = intent.getStringExtra("password");
		
		Intent homeIntent = new Intent(getBaseContext(), ListSubjectActivity.class);
		homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		ServerHelper.login(homeIntent, address, port, username, password);
		
		startActivity(homeIntent);
	}

}
